package com._119yn.host.gst200.properties;

import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

@Data
@RequiredArgsConstructor
@ConfigurationProperties(prefix = "mqtt")
public class MqttProperties {

    private String[] brokerUrls;

    private String username;

    private String password;

    private String clientId;

    private Boolean cleanStart;

    private Integer connectionTimeout;

    private Integer keepAliveInterval;

    private Boolean automaticReconnect;

    private String defaultTopic;

    private Integer defaultQos;

    private Topics topics;

    /**
     * 主题配置
     */
    @Data
    public static class Topics {
        /**
         * 订阅主题
         */
        private SubscribeTopics subscribe;

        /**
         * 发布主题
         */
        private PublishTopics publish;
    }

    /**
     * 订阅主题配置
     */
    @Data
    public static class SubscribeTopics {
        List<Topic> hostControl;
    }

    /**
     * 发布主题配置
     */
    @Data
    public static class PublishTopics {
        List<Topic> hostSignal;
        List<Topic> hostControlAck;
    }

    /**
     * 主题
     */
    @Data
    public static class Topic {
        private String name;
        private Integer qos;
    }

}
